﻿@model TestUp.Models.AdminModels.CreateUserModel

@{
    ViewBag.Title = "Create User";
    Layout = "~/Views/Admin/_AdminLayout.cshtml";
}

<h2>Create User</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm("CreateUser", "Admin"))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>New User</legend>
        <div class="editor-label">
            @(Html.LabelFor(x => x.User.UserName))
        </div>
        <div class="editor-field">
            @(Html.EditorFor(x => x.User.UserName))
        </div>


        <div class="editor-label">
            @(Html.LabelFor(x => x.User.Password))
        </div>
        <div class="editor-field">
            @(Html.EditorFor(x => x.User.Password))
        </div>


        <div class="editor-label">
            @(Html.LabelFor(x => x.User.Firstname))
        </div>
        <div class="editor-field">
            @(Html.EditorFor(x => x.User.Firstname))
        </div>


        <div class="editor-label">
            @(Html.LabelFor(x => x.User.LastName))
        </div>
        <div class="editor-field">
            @(Html.EditorFor(x => x.User.LastName))
        </div>


        <div class="editor-label">
            @(Html.LabelFor(x => x.User.PermissionId))
        </div>
        <div class="editor-field">
            @(Html.Kendo().ComboBoxFor(x => x.User.PermissionId)
                  .Placeholder("Select permission...")
                  .DataTextField("PermissionName")
                  .DataValueField("PermissionId")
                  .BindTo(Model.Permissions)
                  .Suggest(true)
                  )
        </div>
        
        
        <div class="editor-label">
            @(Html.LabelFor(x => x.User.Group.GroupName))
        </div>
        <div class="editor-field">
            @(Html.Kendo().ComboBoxFor(x => x.User.GroupId)
          .Placeholder("Select group...")
          .DataTextField("GroupName")
          .DataValueField("GroupId")
          .BindTo(Model.Groups)
          .Suggest(true)
        )
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "ViewUsers")
</div>
